﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AbacusCustom
{
    public partial class TableList : Form
    {
        frmCreateReport frmcreatereport;
        public TableList(frmCreateReport frmcreatereport)
        {
            InitializeComponent();
            this.frmcreatereport = frmcreatereport;
        }

        private void ColumnList_Load(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            for (int xx = 0; xx < 100; xx++)
            {
                if (!Module.tablelist[xx].Equals(""))
                {
                    DataGridViewRow row2 = new DataGridViewRow();
                    row2.CreateCells(dataGridView1);
                    row2.Cells[0].Value = Module.tablelist[xx];
                    dataGridView1.Rows.Add(row2);
                }
            }
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmcreatereport.setvalue(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString().Trim());
            if (Module.selectedcolumn == 0)
            {
                Module.selectedtable1 = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString().Trim();
            }
            else if(Module.selectedcolumn == 3)
            {
                Module.selectedtable2 = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString().Trim();
            }
            this.Close();
        }
    }
}
